Skip to content
This repository has been archived by the owner on Dec 11, 2020. It is now read-only.

allow chaning service endpoint inside the middleware #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mikz
Copy link
Contributor

@mikz mikz commented Nov 26, 2014

  • added request.endpoint which carries the service endpoint
  • brainslug middleware uses request.endpoint to make the final request

I'm not very happy with the request.endpoint. I would prefer some
global object, a service for example. So it would be service.endpoint.

But it is much harder to implement. Will give it some time to rest and
see.

allows to change endpoint on the fly in the middleware like:

return function(request, next_middleware)
  if request.path == '/some/path' then
    request.endpoint = 'https://example.com'
  end
  return next_middleware()
end

fixes #18

* added `request.endpoint` which carries the service endpoint
* brainslug middleware uses `request.endpoint` to make the final request

I'm not very happy with the `request.endpoint`. I would prefer some
global object, a service for example. So it would be `service.endpoint`.

But it is much harder to implement. Will give it some time to rest and
see.
@galenzhao
Copy link

very useful
please merge to master

@mikz
Copy link
Contributor Author

mikz commented May 17, 2016

@galenzhao have you tried it?

Even if I merge it to master, I'm not sure when I'll be able to do a release.

The release happens from on-premise branch anyway.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feature request: Add path based routing
2 participants